<?php 
$apiType=param('type');
$tid=param('tid');

//置顶
if($apiType=='top'){
	empty($tid)  AND message(1,'tiod不存在');
	$status=thread_read($tid)['top'];
	if($status== 0){
		$res=thread_top_change($tid,1);
		 message(0,'置顶成功');
	}else{
		$res=thread_top_change($tid,0);
		 message(-1,'取消置顶成功');
	}
	
 }

//删除
if($apiType=='del'){
	empty($tid)  AND message(1,'tid不存在');
	$r=thread_delete($tid);
	if($r === FALSE) message(1,'删除失败');
	else{
		$last_tid=$tid-1;
		if(thread_read($last_tid) === FALSE) message(0,$URL."./index.htm");
		else  message(0,"./article-{$last_tid}.htm");
	} 
	
 }

 ?>
